package com.jack.cms.modular.system.api;

import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jack.cms.common.constant.tips.Tip;
import com.jack.cms.common.persistence.model.User;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "/test", description = "测试")
@RequestMapping("/code")
public interface TestApi {

	@ApiOperation(value = "查询用户列表")
	@RequestMapping(value = "/user", method = RequestMethod.GET)
	Tip<List<User>> list(@RequestBody(required = false) String name);

	@ApiOperation(value = "新建用户")
	@RequestMapping(value = "/user", method = RequestMethod.POST)
	Tip<User> create(@RequestBody User user);

	@ApiOperation(value = "更新用户")
	@RequestMapping(value = "/user", method = RequestMethod.PUT)
	Tip<User> update(@RequestBody User user);

	@ApiOperation(value = "根据id查询用户")
	@ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "用户id", paramType = "path") })
	@RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
	Tip<User> byId(@RequestBody @PathVariable(value = "id") String id);

	@ApiOperation(value = "根据id删除用户")
	@ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "用户id", paramType = "path") })
	@RequestMapping(value = "/user/{id}", method = RequestMethod.DELETE)
	Tip<Object> delete(@RequestBody @PathVariable(value = "id") String id);

}
